package com.example.simple.dialog

import android.content.Context
import com.blankj.utilcode.util.ActivityUtils
import com.blankj.utilcode.util.ConvertUtils
import com.example.app.R
import com.gyf.immersionbar.ImmersionBar
import com.lxj.xpopup.XPopup
import com.lxj.xpopup.enums.DragOrientation
import com.lxj.xpopup.enums.PopupAnimation
import com.example.app.base.BasePositionDialog
import com.example.app.databinding.AppStateViewEmptyBinding

/**
 * Description: 自定义自由定位Position弹窗
 */
class SimplePositionDialog(context: Context) : BasePositionDialog<AppStateViewEmptyBinding>(context) {
    override fun getViewBinding() = AppStateViewEmptyBinding.bind(popupImplView)
    override fun getImplLayoutId() = R.layout.app_state_view_empty
    override fun getDragOrientation() = DragOrientation.DragToUp

    companion object {
        fun show(): SimplePositionDialog {
            val context = ActivityUtils.getTopActivity()
            val dialog = SimplePositionDialog(context).apply {
            }
            val topMargin = ImmersionBar.getStatusBarHeight(context) + ConvertUtils.dp2px(16f)
            XPopup.Builder(context)
                .isDestroyOnDismiss(true)
                .isCenterHorizontal(true)
                .offsetY(topMargin)
                .hasShadowBg(false)
                .popupAnimation(PopupAnimation.TranslateFromTop)
                .asCustom(dialog)
                .show()
            return dialog
        }
    }

    override fun onCreate() {
        super.onCreate()
        mViewBinding?.apply {

        }
    }
}